<?php
    defined('_JEXEC') or die(); 
    JHTML::_('behavior.tooltip'); 
    $listOrder    = @$this->lists['order'];
    $listDirn    = @$this->lists['order_Dir'];
?>
<style>
    #tbl_filter{
        margin: 0 ; padding: 0 ;
    }
    #tbl_filter td{
        padding: 3px;
    }
    #tbl_filter input, #tbl_filter img {
        float: left;
        margin: 0 5px 0 0;
        width: auto;
    }
    #extra_filter_field { width: 114px; }
    table.adminlist tbody tr td { padding: 8px 8px; }
    table.adminlist thead th { padding: 8px; }
</style>
<link rel="stylesheet" type="text/css" href="<?php echo JURI::root(); ?>js/multiselect/jquery.multiselect.css" />
<link rel="stylesheet" type="text/css" href="<?php echo JURI::root(); ?>js/multiselect/jquery-ui.css" />
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/jquery.js"></script>
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/multiselect/jquery.multiselect.js"></script>

<script language="javascript" type="text/javascript">
    function submitform(pressbutton){
        var form = document.adminForm ;
        //alert(pressbutton)
        if (pressbutton)
        {
            form.task.value=pressbutton ;
        }
        if ((pressbutton=='send_redemp_notice_email')||(pressbutton=='send_redemp_pick_up_notice')){
              form.controller.value="reports" ;
        }
        form.submit();
    }
    jQuery(function(){ 
        jQuery("#statisitc_by").val("<?php echo $this->lists['statistic_by'] ?>");
        jQuery("#extra_type").multiselect({
            selectedList: 0,
            noneSelectedText: '-- All --',
            selectedText: "# of # selected"
        }); 
       
        jQuery("#pick_up_at").multiselect({
            selectedList: 0,
            noneSelectedText: '-- All --',
            selectedText: "# of # selected"
        });
        jQuery("#member_type").multiselect({
            selectedList: 0,
            noneSelectedText: '-- All --',
            selectedText: "# of # selected"
        }); 
    });
    
</script>
<div class="row-fluid">
    <?php if (!empty( $this->sidebar)) : ?>
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
	<?php else : ?>
		<div id="j-main-container">
	<?php endif;?>
		<br clear="all">	
    	<div class="alert">
            <form action="<?php echo JRoute::_("index.php?option=com_wrd&controller=reports")?>" method="post" name="filterform" >
                <table style='margin-bottom:5px' id="tbl_filter">
                    <tbody>
                        <tr>
                            <td align="left" valign="top" style="border-right: 1px solid #d0d0d0;">
                                <table >
                                    <tr>
                                        
                                        <td>From:<br>
                                            <?php
                                                echo JHTML::_ ( 'calendar', ($this->pr['date_from'] != '') ? $this->pr['date_from'] : date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y'))), 'date_from', 'date_from', '%Y-%m-%d');
                                            ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        
                                        <td>To:<br>
                                            <?php
                                                echo JHTML::_ ( 'calendar', ($this->pr['date_to'] != '') ? $this->pr['date_to'] : date('Y-m-d', time()), 'date_to', 'date_to', '%Y-%m-%d');
                                            ?>
                                        </td>
                                    </tr>
                                </table>                                
                            </td>
                                                        
                            <td align="left" valign="top" id="statistic_by_age" style="border-right: 1px solid #d0d0d0;">
                                <table >
                                    <tr>
                                        
                                        <td>Search by:<br>
                                            <?php echo $this->lists['extra_filter_field']; ?>
                                        </td>
                                    </tr>  
                                    <tr>
                                        
                                        <td>Value:<br>
                                            <input type="text" name="search_value" id="search_value" value="<?php echo $this->lists['search_value']; ?>" />
                                        </td>
                                    </tr>   
                                    <tr>
                                        
                                        <td>Handle by:<br>
                                            <?php echo $this->lists['filter_handle_by']; ?>
                                        </td>
                                    </tr>                                                                                                                                     
                                </table>
                            </td>
                                                        
                             <td align="left" valign="top" id="statistic_by_job" style="border-right: 1px solid #d0d0d0;">
                                <table >                                    
                                    <tr>
                                        <td>Outlet:<br>
                                            <?php echo $this->lists['filter_pick_up_outlet'] ; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Type:<br>
                                            <?php echo $this->lists['filter_member_type'] ; ?>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            
                            <td align="left" valign="top" id="last_filter_column">
                                <table >
                                    <tr>
                                        <td>
                                            Choose: <br>
                                            <select name="topDisplaySelect" id="topDisplaySelect">
                                                <option value="10">10</option>
                                                <option value="20">20</option>
                                                <option value="50">50</option>
                                                <option value="100">100</option>
                                                <option value="">All</option>
                                            </select><br>&nbsp;or type&nbsp;<br>
                                            <input name="topDisplaytbx" id="topDisplaytbx" type="text" style="width: 60px; float: none;" />
                                        </td>
                                    </tr>
                                    <tr valign="top">
                                        
                                        <td style="text-align: left;padding: 10px 3px 0;">
                                            <input type="submit" name="view" onclick="document.getElementById('submitViewExcel').value = 'submitViewExcel';  document.getElementById('task').value = 'memberservicereport';" value="View" />
                                        <input type="submit" name="exportexcel" onclick="document.getElementById('submitViewExcel').value = 'submitViewExcel';  document.getElementById('task').value = 'exmemberservicereport';" value="Export to excel" /></td>
                                    </tr>
                                </table>
                            </td>                       
                        </tr>
                    </tbody>
                </table>
                <input type="hidden" name="controller" value="reports" />
                <input type="hidden" name="option" value="com_wrd" />
                <input type="hidden" name="submitViewExcel" id="submitViewExcel" value="" />
                <input type="hidden" name="task" id="task" value="" />
            </form>
            </div>
            <br />
            <form  id="adminForm"  action="<?php echo JRoute::_("index.php?option=com_wrd&controller=reports")?>" method="post" name="adminForm" >
                <?php                     
                    echo $this->loadtemplate('filter') ;
                                        
                ?>
                <input type="hidden" name="controller" value="reports" />
                <input type="hidden" name="option" value="com_wrd" />
                <input type="hidden" name="task" value="memberservicereport" />
                <input type="hidden" name="boxchecked" value="0" />
                <?php echo JHTML::_( 'form.token' ); ?>
            </form>
        </div>
        
</div>
